﻿<UserControl x:Class="theeg.DependencyAnalysis.CommonAddin.Views.ArchitectureGraph"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:graphWpf="clr-namespace:theeg.GraphWpf;assembly=theeg.GraphWpf"
             xmlns:converters="clr-namespace:theeg.DependencyAnalysis.CommonAddin.Converters"
             mc:Ignorable="d" 
             FontWeight="Normal" FontSize="16"
             d:DesignHeight="400" d:DesignWidth="1000">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/theeg.GraphWpf;component/Resources/Theme.xaml" />
                <ResourceDictionary Source="../Resources/CommonStyles.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>

            <converters:HiddenNodeToNameConverter x:Key="HiddenNodeToNameConverter"></converters:HiddenNodeToNameConverter>
            <DataTemplate x:Key="HiddenNodeTemplate">
                <TextBlock Text="{Binding Path=., Converter={StaticResource HiddenNodeToNameConverter}}"></TextBlock>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid ClipToBounds="True" Background="Transparent">
        <graphWpf:Sketch x:Name="Sketch" Background="Transparent" InputUp="ClickGraphItem" InputDouble="DoubleClickGraphItem"></graphWpf:Sketch>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
            <Button x:Name="OptionsButton" Style="{StaticResource NullButtonStyle}" Margin="8,0,0,0" Click="ToggleOptions" Command="{x:Null}">
                <StackPanel Orientation="Horizontal">
                    <Path Width="24" Height="24" Stretch="Uniform" Fill="White" Stroke="Gray" StrokeThickness="1" Data="M 524.03107 987.5 C 420.50018 987.5 336.53107 903.50037 336.53107 800 C 336.53107 696.4691 420.50018 612.5 524.03107 612.5 C 627.56195 612.5 711.53107 696.4691 711.53107 800 C 711.53107 903.50037 627.56195 987.5 524.03107 987.5 M 1025 861.53107 L 1025 736.53107 L 875.59357 674.28093 C 871.43745 662.56218 867.062 651.2497 861.6871 640.0936 L 921.96884 489.9376 L 833.59375 401.5625 L 684.78146 462.8437 C 673.4375 457.40585 661.8122 452.78053 649.8436 448.4375 L 586.53107 300 L 461.53107 300 L 399.75014 447.93777 C 387.31232 452.34375 375.3437 456.96907 363.46855 462.59384 L 214.93759 402.96822 L 126.5625 491.3433 L 187.12463 638.562 C 181.25 650.59357 176.46828 662.96844 171.96884 675.65613 L 25 738.46893 L 25 863.46893 L 172.0623 924.75014 C 176.62468 937.4378 181.49986 949.8432 187.3745 961.87477 L 127.87476 1110.0624 L 216.24985 1198.4375 L 363.87482 1137.656 C 375.68703 1143.2503 387.81204 1147.8432 400.24986 1152.0622 L 463.46893 1300 L 588.49945 1300 L 650.34332 1151.31264 C 662.21848 1146.9372 673.93723 1142.28134 685.15625 1136.9064 L 835.0624 1196.96884 L 923.4375 1108.59375 L 861.93695 959.4372 C 867.12494 948.18764 871.43745 936.90567 875.59357 925.24986 Z"></Path>
                    <TextBlock Margin="2,0" Text="Options panel"></TextBlock>
                </StackPanel>
            </Button>
            <ToggleButton x:Name="HideButton" Style="{StaticResource NullToggleButtonStyle}" Margin="8,0,0,0" Click="ToggleHideMode" Command="{x:Null}">
                <StackPanel Orientation="Horizontal">
                    <Viewbox Width="24" Height="24">
                        <Grid Margin="-90,-134,0,0">
                            <Path Opacity="0.8" Fill="LightBlue" Data="M150.035,151.694c-7.154-9.717-17.779-15.288-29.158-15.288
	c-10.871,0-21.193,5.17-28.318,14.187l-1.025,1.297l0.98,1.331c7.154,9.717,17.781,15.287,29.158,15.287
	c10.871,0,21.193-5.17,28.32-14.186l1.023-1.298L150.035,151.694z M95.852,152.129c4.131-4.748,9.305-8.13,14.947-9.878
	c-2.826,2.477-4.621,6.1-4.621,10.143c0,4.188,1.92,7.939,4.924,10.417C105.279,160.906,99.998,157.252,95.852,152.129z
	 M130.568,162.811c2.826-2.478,4.621-6.101,4.621-10.145c0-4.189-1.92-7.938-4.926-10.415c5.824,1.903,11.105,5.558,15.252,10.679
	C141.385,157.679,136.211,161.061,130.568,162.811z M95.852,152.129c4.131-4.748,9.305-8.13,14.947-9.878
	c-2.826,2.477-4.621,6.1-4.621,10.143c0,4.188,1.92,7.939,4.924,10.417C105.279,160.906,99.998,157.252,95.852,152.129z
	 M130.568,162.811c2.826-2.478,4.621-6.101,4.621-10.145c0-4.189-1.92-7.938-4.926-10.415c5.824,1.903,11.105,5.558,15.252,10.679
	C141.385,157.679,136.211,161.061,130.568,162.811z"/>
                            <Path Fill="#FFFFFF" Data="M95.852,152.129c4.131-4.748,9.305-8.13,14.947-9.878c-2.826,2.477-4.621,6.1-4.621,10.143
	c0,4.188,1.92,7.939,4.924,10.417C105.279,160.906,99.998,157.252,95.852,152.129z"/>
                            <Path Fill="#FFFFFF" Data="M130.568,162.811c2.826-2.478,4.621-6.101,4.621-10.145c0-4.189-1.92-7.938-4.926-10.415
	c5.824,1.903,11.105,5.558,15.252,10.679C141.385,157.679,136.211,161.061,130.568,162.811z"/>
                            <Path Fill="Red" Stroke="Red" StrokeThickness="5" Data="M90,130 L152,170"/>
                            <Path Fill="Red" Stroke="Red" StrokeThickness="5" Data="M90,170 L152,130"/>
                        </Grid>
                    </Viewbox>
                    <TextBlock Margin="2,0" Text="Hide nodes"></TextBlock>
                </StackPanel>
            </ToggleButton>
        </StackPanel>
        <Border x:Name="OptionsPopup" CornerRadius="5" Background="#FF222222" BorderBrush="Black" BorderThickness="1" Margin="20, 30"
                Width="480" Visibility="Collapsed" HorizontalAlignment="Left">
            <Border CornerRadius="5" Background="#FF222222" BorderBrush="White" BorderThickness="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Border VerticalAlignment="Bottom" BorderBrush="#FF25334B" BorderThickness="2"></Border>
                    <TextBlock Text="Options" FontWeight="Bold" FontSize="18" Foreground="White" HorizontalAlignment="Left" Margin="3"></TextBlock>
                    <Button Command="{x:Null}" Click="ToggleOptions" Style="{StaticResource FlatButtonStyle}" HorizontalAlignment="Right"
                                Margin="8,0,0,0">
                        <Viewbox Width="25">
                            <Canvas Width="100" Height="100">
                                <Path Stroke="White" StrokeThickness="6" Fill="#01000000">
                                    <Path.Data>
                                        <EllipseGeometry RadiusX="47" RadiusY="47" Center="50,50" />
                                    </Path.Data>
                                </Path>
                                <Path Stroke="White" StrokeThickness="6">
                                    <Path.Data>M27,27L73,73 M27,73 L73,27</Path.Data>
                                </Path>
                            </Canvas>
                        </Viewbox>
                    </Button>
                    <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" PanningMode="Both" Grid.Row="1">
                        <StackPanel>
                            <CheckBox IsChecked="{Binding ShowProjectOnly}" Foreground="White" Margin="8,2,0,2">Limit modules to project</CheckBox>
                            <CheckBox IsChecked="{Binding IsHorizontal}" Foreground="White" Margin="8,2,0,2">Horizontal arrangement</CheckBox>
                            <CheckBox IsChecked="{Binding HideTransitiveEdges}" Foreground="White" Margin="8,2,0,2">Hide transitive edges</CheckBox>
                            <CheckBox IsChecked="{Binding CompactClassView}" Foreground="White" Margin="8,2,0,2">Compact class view</CheckBox>
                            <Button Command="{Binding UncoverNodesCommand}" Style="{StaticResource NullButtonStyle}" Margin="8,2">
                                <StackPanel Orientation="Horizontal">
                                    <Viewbox Width="24" Height="24">
                                        <Grid Margin="-90,-134,0,0">
                                            <Path Opacity="0.8" Fill="LightBlue" Data="M150.035,151.694c-7.154-9.717-17.779-15.288-29.158-15.288
	c-10.871,0-21.193,5.17-28.318,14.187l-1.025,1.297l0.98,1.331c7.154,9.717,17.781,15.287,29.158,15.287
	c10.871,0,21.193-5.17,28.32-14.186l1.023-1.298L150.035,151.694z M95.852,152.129c4.131-4.748,9.305-8.13,14.947-9.878
	c-2.826,2.477-4.621,6.1-4.621,10.143c0,4.188,1.92,7.939,4.924,10.417C105.279,160.906,99.998,157.252,95.852,152.129z
	 M130.568,162.811c2.826-2.478,4.621-6.101,4.621-10.145c0-4.189-1.92-7.938-4.926-10.415c5.824,1.903,11.105,5.558,15.252,10.679
	C141.385,157.679,136.211,161.061,130.568,162.811z M95.852,152.129c4.131-4.748,9.305-8.13,14.947-9.878
	c-2.826,2.477-4.621,6.1-4.621,10.143c0,4.188,1.92,7.939,4.924,10.417C105.279,160.906,99.998,157.252,95.852,152.129z
	 M130.568,162.811c2.826-2.478,4.621-6.101,4.621-10.145c0-4.189-1.92-7.938-4.926-10.415c5.824,1.903,11.105,5.558,15.252,10.679
	C141.385,157.679,136.211,161.061,130.568,162.811z"/>
                                            <Path Fill="#FFFFFF" Data="M95.852,152.129c4.131-4.748,9.305-8.13,14.947-9.878c-2.826,2.477-4.621,6.1-4.621,10.143
	c0,4.188,1.92,7.939,4.924,10.417C105.279,160.906,99.998,157.252,95.852,152.129z"/>
                                            <Path Fill="#FFFFFF" Data="M130.568,162.811c2.826-2.478,4.621-6.101,4.621-10.145c0-4.189-1.92-7.938-4.926-10.415
	c5.824,1.903,11.105,5.558,15.252,10.679C141.385,157.679,136.211,161.061,130.568,162.811z"/>
                                        </Grid>
                                    </Viewbox>
                                    <TextBlock Text="Uncover all hidden nodes"></TextBlock>
                                </StackPanel>
                            </Button>
                            <Separator Background="White"></Separator>
                            <ItemsControl ItemsSource="{Binding HiddenNodes}" ItemTemplate="{StaticResource HiddenNodeTemplate}"
                      Background="Transparent" AlternationCount="2">
                                <ItemsControl.Template>
                                    <ControlTemplate>
                                        <StackPanel IsItemsHost="True"></StackPanel>
                                    </ControlTemplate>
                                </ItemsControl.Template>
                            </ItemsControl>
                        </StackPanel>
                    </ScrollViewer>
                </Grid>
            </Border>
        </Border>
    </Grid>
</UserControl>
